/**
 * harmony.bean.Etape.java
 * @author xavier.miorcec@elomobile.com
 * @ELO_dev_bernardi_200812
 */
package com.elomobile.harmony.bean.generationElo;

import java.util.ArrayList;

import com.elomobile.harmony.utils.UtilsBernardi;

public class Etape implements Comparable<Etape> {

	private String codeTiers;
	private String date1 = "";
	private String dateNonTranscrite = "";
	private String heure1 = "";
	private String codeEtape;
	private int etatEtape;
	private String infoEtape;
	private Action action;
	private String libelleEtape;
	private String commentaireEtape;
	private boolean isPortDu = false;
	private boolean isNeutraliteCommerciale = false;

	private String heureRdv;
	private String avantApresRdv = "";

	private String couleurEcritureCommentaire;
	private String couleurFondEtape;

	private ArrayList<Action> listeAction;

	private int numeroSequence;

	/**
	 * @param action
	 */
	public Etape() {
		this.action = new Action();
	}

	/**
	 * @return the codeTiers
	 */
	public String getCodeTiers() {
		return codeTiers;
	}

	/**
	 * @return the date1
	 */
	public String getDate1() {
		if (date1 != null && date1.length() > 0) {
			date1 = UtilsBernardi.formatterDatePDAD(date1);
			date1 = date1.substring(0, 8);
			date1 = UtilsBernardi.formaterDateADINFOtoDateExport(date1);
		}
		return date1;
	}

	public String getDate1NonTranscrite() {
		return dateNonTranscrite;
	}

	/**
	 * @return the codeEtape
	 */
	public String getCodeEtape() {
		return codeEtape;
	}

	/**
	 * @return the etatEtape
	 */
	public int getEtatEtape() {
		return etatEtape;
	}

	/**
	 * @param codeTiers the codeTiers to set
	 */
	public void setCodeTiers(String codeTiers) {
		this.codeTiers = codeTiers;
	}

	/**
	 * @param date1 the date1 to set
	 */
	public void setDate1(String date1) {
		this.dateNonTranscrite = date1;
		this.date1 = date1;
	}

	/**
	 * @param codeEtape the codeEtape to set
	 */
	public void setCodeEtape(String codeEtape) {
		this.codeEtape = codeEtape;
	}

	/**
	 * @param etatEtape the etatEtape to set
	 */
	public void setEtatEtape(int etatEtape) {
		this.etatEtape = etatEtape;
	}

	/**
	 * @return the infoEtape
	 */
	public String getInfoEtape() {
		return infoEtape;
	}

	/**
	 * @param infoEtape the infoEtape to set
	 */
	public void setInfoEtape(String infoEtape) {
		this.infoEtape = infoEtape;
	}

	/**
	 * @return the action
	 */
	public Action getAction() {
		return action;
	}

	/**
	 * @param action the action to set
	 */
	public void setAction(Action action) {
		this.action = action;
	}

	/**
	 * @return the libelleEtape
	 */
	public String getLibelleEtape() {
		if (libelleEtape != null && libelleEtape.length() > 24) {
			return (libelleEtape.substring(0, 23) + ".").toLowerCase();
		}

		if (libelleEtape != null) {
			return libelleEtape.toLowerCase();
		}
		return libelleEtape;
	}

	/**
	 * @param libelleEtape the libelleEtape to set
	 */
	public void setLibelleEtape(String libelleEtape) {
		this.libelleEtape = libelleEtape;
	}

	/**
	 * @return the commentaireEtape
	 */
	public String getCommentaireEtape() {
		if (commentaireEtape != null) {
			return commentaireEtape.toLowerCase();
		}
		return commentaireEtape;
	}

	/**
	 * @param commentaireEtape the commentaireEtape to set
	 */
	public void setCommentaireEtape(String commentaireEtape) {
		this.commentaireEtape = commentaireEtape;
	}

	/**
	 * @return the listeAction
	 */
	public ArrayList<Action> getListeAction() {
		if (this.listeAction == null) {
			this.listeAction = new ArrayList<Action>();
		}
		return listeAction;
	}

	/**
	 * @param listeAction the listeAction to set
	 */
	public void setListeAction(ArrayList<Action> listeAction) {
		this.listeAction = listeAction;
	}

	/**
	 * @return the heure1
	 */
	public String getHeure1() {
		return heure1;
	}

	/**
	 * @param heure1 the heure1 to set
	 */
	public void setHeure1(String heure1) {
		this.heure1 = heure1;
	}

	/**
	 * @return the heureRdv
	 */
	public String getHeureRdv() {
		return heureRdv;
	}

	/**
	 * @param heureRdv the heureRdv to set
	 */
	public void setHeureRdv(String heureRdv) {
		this.heureRdv = heureRdv;
	}

	/**
	 * @return the isPortDu
	 */
	public boolean isPortDu() {
		return isPortDu;
	}

	/**
	 * @return the isNeutraliteCommerciale
	 */
	public boolean isNeutraliteCommerciale() {
		return isNeutraliteCommerciale;
	}

	/**
	 * @param isPortDu the isPortDu to set
	 */
	public void setPortDu(boolean isPortDu) {
		this.isPortDu = isPortDu;
	}

	/**
	 * @param isNeutraliteCommerciale the isNeutraliteCommerciale to set
	 */
	public void setNeutraliteCommerciale(boolean isNeutraliteCommerciale) {
		this.isNeutraliteCommerciale = isNeutraliteCommerciale;
	}

	/**
	 * @return the couleurEcritureCommentaire
	 */
	public String getCouleurEcritureCommentaire() {
		return couleurEcritureCommentaire;
	}

	/**
	 * @return the couleurFondEtape
	 */
	public String getCouleurFondEtape() {
		return couleurFondEtape;
	}

	/**
	 * @param couleurEcritureCommentaire the couleurEcritureCommentaire to set
	 */
	public void setCouleurEcritureCommentaire(String couleurEcritureCommentaire) {
		this.couleurEcritureCommentaire = couleurEcritureCommentaire;
	}

	/**
	 * @param couleurFondEtape the couleurFondEtape to set
	 */
	public void setCouleurFondEtape(String couleurFondEtape) {
		this.couleurFondEtape = couleurFondEtape;
	}

	public int compareTo(Etape etape) {
		String dateIci = date1 + heure1;
		String dateEtape = etape.date1 + etape.heure1;
		return dateIci.compareTo(dateEtape);
	}

	/**
	 * @return the avantApresRdv
	 */
	public String getAvantApresRdv() {
		return avantApresRdv;
	}

	/**
	 * @param avantApresRdv the avantApresRdv to set
	 */
	public void setAvantApresRdv(String avantApresRdv) {
		this.avantApresRdv = avantApresRdv;
	}

	public int getNumeroSequence() {
		return numeroSequence;
	}

	public void setNumeroSequence(int numeroSequence) {
		this.numeroSequence = numeroSequence;
	}
}
